package com.sskj.level.presenter;

import com.sskj.common.base.HttpData;
import com.sskj.level.http.HttpConfig;
import com.sskj.level.ui.fragment.LevelFragment;
import com.sskj.lib.RxBusCode;
import com.sskj.lib.bean.CoinBean;
import com.sskj.lib.box.LiveDataBus;
import com.sskj.lib.http.CallBackOption;

import java.util.List;


public class LevelFragmentPresenter extends BasePresenter<LevelFragment> {


    public void getProduct(String code) {
        httpService.getPro(code)
                .execute(new CallBackOption<HttpData<List<CoinBean>>>() {
                }
                        .unLoadBind(mView)
                        .execute(httpData -> {
                            if (httpData.getStatus() == HttpConfig.OK) {
                                LiveDataBus.get().with(RxBusCode.PUSH_COIN_BEAN_BIBI, CoinBean.class).postValue(httpData.getData().get(0));
                            }
                        }));
    }


}
